#include "Expr.h"
#include "IVisitor.h"

Expr::Expr(const exprTypePtr& value, int nodeId):
    stmtType(nodeId),
    _value(value)
{
}
    
Expr::~Expr()
{
    
}
    
Ast::AstTypes Expr::type() const
{
    return Ast::Expr;
}
    

exprTypePtr Expr::value()
{
    return _value;
}

void Expr::setValue(const exprTypePtr& value)
{
    _value = value;
}

    
QString Expr::toString() const
{
    return QString("Expr[value=%1]").
                arg(_value ? _value->toString():"");
}
    
void Expr::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    visitor->visitExpr(node.dynamicCast<Expr>());
}
    
void Expr::traverse(IVisitor* visitor)
{
    if (_value != NULL)
        _value->accept(visitor, _value);
}